<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.list.WuFaPeiSongDingDanTiaoMuMingXi"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.group-info {
            margin-top: 10px !important;
            margin-bottom: 0px !important;
        }
        input.innerInput {
            width: 98%;
        }
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.list.WuFaPeiSongDingDanTiaoMuMingXi"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.listForm.PeiSongGuanLi"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.list.PeiSongZhongDingDan"/></a></li>
        </ol>
     </section>
     
     
     <section class="content" style="min-height:inherit;">
          <form id="form" class="form-horizontal"  method="post">
            <input type="hidden" name=orderPackId value="${orderPackId}" />
            
            <div class="box box-success" style="margin-bottom: 0px;padding-bottom: 10px;">
               <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.listForm.DingDanBaoHao"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div class="col-sm-4 text-left" >${orderPackId}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.lable.yiLiaoJiGouMingCheng"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="hospName" class="col-sm-4 text-left"></div>
                </div>
                 
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.listForm.YiLiaoJiGouSuoShuDiQu"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="areaName" class="col-sm-4 text-left"></div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.listForm.CaiGouShiJian"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="submitDateTime" class="col-sm-4 text-left"></div>
                </div>
                
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.listForm.DingDanKaiShiRiQi"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="beginTime" class="col-sm-4 text-left"></div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.listForm.DingDanJieShuRiQi"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="endTime" class="col-sm-4 text-left"></div>
                </div> 
                
                 <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.listForm.beiZhu"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div id="remarks" class="col-sm-10 text-left"></div>
                </div>
                
            </div>
        </form>
     </section>
        
    
    
    <section class="content">
        <div class=" box box-primary">
            <div class="box-body">
               <div class="input">
		    		<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugName" name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="drugCode" name="drugCode"  placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
                    </div>
                    <div class="textalign1"><spring:message code="message.listForm.ShengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                         <input type="text" class="textinput" id="prodComp" name="prodComp"  placeholder="<spring:message code="message.listForm.ShengChanQiYe"/>" />
                    </div>
					<div class="textalign1" > 
                   <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                   </div>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
         <div class=" box box-warning bottongroup">
            <a href="${ctx}/orderAlready/toOrderAlready.html" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
        </div>
        
   </section>
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
   <script type="text/javascript">
   $(function () {
       $("#gridlist").jqGrid({
           url: "${ctx}/orderAlready/getWfpsOrderDetail.html",
           mtype: "POST",
           postData:{"orderPackId":"${orderPackId}"},
           datatype: "json",
           autowidth: true,
           shrinkToFit: false,
           height: 270,
           colNames: [
					  '<spring:message code="message.jqGrid.cz"/>',
                      'orderId',
                      'orderCode',
                      'orderPackId',
                      'hospId',
                      'areaName',
                      'areaId',
                      'beginTime',
                      'endTime',
                      'submitDateTime',
                      'remarks',
                      '<spring:message code="message.listForm.CaiGouShuLiang"/>',
                      '<spring:message code="message.listForm.CaiGouJia"/>',
                      '<spring:message code="message.listForm.CaiGouJinE"/>',
                      '<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>',
                      '<spring:message code="message.listForm.yaoPinBianMa"/>',
	                  '<spring:message code="message.listForm.tongYongMing"/>', 
	                  '<spring:message code="message.listForm.jiXing"/>',
	                  '<spring:message code="message.listForm.guiGe"/>',
	                  '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
	                  '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
	                  '<spring:message code="message.listForm.caiZhi"/>',
	                  '<spring:message code="message.listForm.shengChanQiYe"/>',
	                  '<spring:message code="message.lable.suoShuXiangMu"/>',
                      '<spring:message code="message.listForm.CaiGouXianJia"/>',
			          '<spring:message code="message.listForm.IsorNoBeiAn"/>',
			          '<spring:message code="message.listForm.BeiAnLeiXing"/>'
			          
                      ],
           colModel: [
				{ name: 'operate', width: 60, align:"center", sortable: false,
				    formatter : function(val, opts, row) {
				        return '<a href="javascript:showOrderId(\''+ row.orderId +'\');"><spring:message code="message.listForm.WuLiuXinXi"/></a>';
				}
				}, 
               { name: 'orderId', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'orderCode', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'orderPackId', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'hospId', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'areaName', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'areaId', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'beginTime', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'endTime', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'submitDateTime', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               { name: 'remarks', index: 'ship',hidden:true, width: 50,align:"center",sortable:false},
               
               { name: 'proCount', index: 'sdate', width: 60, align: "center",sortable:false},
               { name: 'proPrice', index: 'sdate', width: 60, align: "right",sortable:false,
             	   formatter:function(cellvalue, options, row){
                       return formatAmount(cellvalue, options, row);
                   }},
               { name: 'orderMoney', index: 'sdate', width: 60, align: "right",sortable:false,
             	   formatter:function(cellvalue, options, row){
                       return formatAmount(cellvalue, options, row);
                   }},
               { name: 'hospName', index: 'ship', width: 160,align:"center",sortable:false,
                   formatter:function(cellvalue, options, row){
                       return '<a href="javascript:showHospInfo(\''+ row.hospId +'\');">'+cellvalue+'</a>';
                   }
               },
               { name: 'drugCode', index: 'ship', width: 90, align: "center",sortable:false,
                   formatter:function(cellvalue, options, row){
                       return '<a href="javascript:showDrugInfo(\''+ row.drugId +'\');">'+cellvalue+'</a>';
                   }
               },
               { name: 'drugName', index: 'name', width: 120, align: "center" ,sortable:false },
               { name: 'formName', index: 'stock', width: 60 , align: "center",sortable:false},
               { name: 'specName', index: 'ship', width: 80, align: "center" ,sortable:false},
               { name: 'factor', index: 'ship', width: 60, align: "center" ,sortable:false},
               { name: 'unit', index: 'ship', width: 60, align: "center" ,sortable:false},
               { name: 'materialName', index: 'ship', width: 60, align: "center" ,sortable:false},
               { name: 'prodComp', index: 'ship', width: 160, align: "center",sortable:false,
                   formatter:function(cellvalue, options, row){
                       return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                   }
               },
               { name: 'projName',hidden:true, index: 'ship', width: 160, align: "center",sortable:false},
               { name: 'proPriceLimit', index: 'ship', width: 60,align:"right",sortable:false,
             	   formatter:function(cellvalue, options, row){
                       return formatAmount(cellvalue, options, row);
                   }},
               { name: 'bakDrugFlag', index: 'ship', width: 80,align:"center",sortable:false,
                   formatter:function(cellvalue, options, row){
                       return cellvalue == 1 ? "<spring:message code="message.listForm.shi"/>" : "<spring:message code="message.listForm.fou"/>";
                   }
               },
               { name: 'isLongTimePlan', index: 'ship', width: 80,align:"center",sortable:false,
                   formatter:function(cellvalue, options, row){
                       var str = "";
                       if (row.bakDrugFlag == 1) {
                           str = cellvalue == 1 ? "<spring:message code="message.listForm.ChangQi"/>" : "<spring:message code="message.listForm.LinShi"/>";
                       }else{
                    	   str = "--";
                       }
                       return str;
                   }
               }
               
           ],
           rowNum: 20,
           rowList: [10, 20, 50, 100],
           rownumbers: true,
           pager: "#gridpage",
           multiselect: true, 
           viewrecords: false,
           gridComplete: function(){
              	 //序号列宽度自适应（参数为jqgridID）
                     autoRNWidth("gridlist");
                 	//数据只有一条时默认选中（参数为jqgridID）
                     selectByOneData("gridlist");
        	   
               var ids = jQuery("#gridlist").jqGrid('getDataIDs');
               var id = ids[0];
               if(id != null || id != ""){
                   var rowdata = $("#gridlist").jqGrid('getRowData', id);
                   $('#hospName').html(rowdata.hospName);
                   $('#areaName').html(rowdata.areaName);
                   $('#submitDateTime').html(rowdata.submitDateTime);
                   $('#beginTime').html(rowdata.beginTime);
                   $('#endTime').html(rowdata.endTime);
                   $('#remarks').html(rowdata.remarks);
               }  
           }, 
           caption: "<spring:message code="message.list.DingDanMingXiLieBiao"/>",
           jsonReader: {
               repeatitems: false,
               id: "ids"
           }
       });
       $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
       $(window).trigger("resize");
   });
   
   

//查询
   function gridSerch() {
       var drugCode = $.trim($("#drugCode").val());
       var drugName = $.trim($("#drugName").val());
       var prodComp = $.trim($("#prodComp").val());
       $("#gridlist").jqGrid('setGridParam',{  
           datatype:'json',
           postData:{"drugCode":drugCode,
                   "drugName":drugName,
                   "prodComp":prodComp},
                   page:1
       }).trigger("reloadGrid"); //重新载入  
   }
 
   
   //医疗机构信息弹窗
   function showHospInfo(hospId) {
       $.HN.dialog.open({
           "id": "showHospInfo", 
           "title": "<spring:message code="message.listForm.yiLiaoJiGouxinxi"/>", 
           "url": "${ctx}/stdHospInfo/hospInfoDetail.html?hospId="+hospId,
           "data": {}, 
           "width": 800, 
           "height": 400, 
           "closefunc":function() {
               
           }
       });
   }
   
   //药品信息弹窗
   function showDrugInfo(drugId) {
       $.HN.dialog.open({
           "id": "showDrugInfo", 
           "title": "<spring:message code="message.listForm.YaoPinXinXi"/>", 
           "url": "${ctx}/stdDrug/drugInfoDetail.html?drugId="+drugId,
           "data": {}, 
           "width": 800, 
           "height": 400, 
           "closefunc":function() {
               
           }
       });
   }
   
   //生产企业信息弹窗
   function showCompInfo(prodCompId) {
       $.HN.dialog.open({
           "id": "showCompInfo", 
           "title": "<spring:message code="message.listForm.ShengChanQiYeXinXi"/>", 
           "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
           "data": {}, 
           "width": 800, 
           "height": 400, 
           "closefunc":function() {
               
           }
       });
   }
   
   
   //订单明细编号 链接 订单追踪页面
   function showOrderId(orderId) {
      $.HN.dialog.open({
          "id": "showOrderId", 
          "title": "<spring:message code="message.list.DingDanWuLiuXinXi"/>", 
          "url": "${ctx}/purOrderInfo//toOrderLogisticsById.html?orderId="+orderId,
          "data": {}, 
          "width": 800, 
          "height": 400, 
          "closefunc":function() {
              
          }
      });
  } 

   
        
   </script>
        
</body>
</html>
